<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="en">

<head>
<title>忘记密码</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<link rel="stylesheet" href="static/login/bootstrap.min.css" />
<link rel="stylesheet" href="static/login/css/camera.css" />
<link rel="stylesheet" href="static/login/bootstrap-responsive.min.css" />
<link rel="stylesheet" href="static/login/matrix-login.css" />
<link href="static/login/font-awesome.css" rel="stylesheet" />
<script type="text/javascript" src="static/js/jquery-1.5.1.min.js"></script>

</head>
<script type="text/javascript">
        //点击下一步验证
        function resetPwd(){
           var email = $("#email").val();
           var vertifyCode = $("#div_vertifyCode").val();
           if(typeof(email)=='undefined'||""==email){
               $("#email").tips({
					side : 2,
					msg : '邮箱不得为空',
					bg : '#AE81FF',
					time : 3
				});
				$("#email").focus();
				return false;
           }else if(typeof(vertifyCode)=='undefined'||""==vertifyCode){
                $("#div_vertifyCode").tips({
					side : 2,
					msg : '验证码不得为空',
					bg : '#AE81FF',
					time : 3
				});
				$("#div_vertifyCode").focus();
				return false;
           }
           
               $("#emailCode").val(email);
               $("#vCode").val(vertifyCode);
               $("#loginForm").submit();
        }
        //发送验证码
    	function sendCode(){
			var email = $("#email").val();
			if ($("#email").val() == "") {
				$("#email").tips({
					side : 2,
					msg : '邮箱不得为空',
					bg : '#AE81FF',
					time : 3
				});
				$("#email").focus();
				return false;
			}else{
			    var reg=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((.[a-zA-Z0-9_-]{2,3}){1,2})$/;
			    if(!reg.test($("#email").val())){
				    $("#email").tips({
						side : 2,
						msg : '邮箱格式不正确',
						bg : '#AE81FF',
						time : 3
					});
					$("#email").focus();
					return false;
			    }
			}
			$.ajax({
				url:"sendCode",
				type:"post",
				data:{"email":email},
				dataType:"json",
				success:function(result){
           		 alert(result.message)
           			if(result.code=="300"){
           				$("#email").tips({
							side : 2,
							msg : result.message,
							bg : '#AE81FF',
							time : 3
				       });
						$("#email").focus();
						return false;
						
           			}else{//验证通过
           				show(120);
           			}
				}
			});
		}
		//设置时间
			function show(time){
			aalert("ss");
			   time =time-1;
			   if(time==-1){
			     $("#send_code").attr("disabled",false).css("bgcolor","gray");
			     $("#next_step").attr("disabled",true);
			   }else{
			     $("#send_code").attr("disabled",true);
			     $("#next_step").attr("disabled",false);
			     var mess = "发送验证码("+time+")";
				 document.getElementById("send_code").value=mess;
			   }
			   
			   setTimeout("show("+time+")", 1000);
			}
</script>
<body>
	<div
		style="width:100%;text-align: center;margin: 0 auto;position: absolute;">
		<div id="loginbox">
			<form action="resetPwd" method="post" name="loginForm" id="loginForm">
			     <input type="hidden" id="emailCode" name="email" value=""/>
       		     <input type="hidden" id="vCode" name="vertifyCode" value=""/>
				
				<div class="control-group normal_text">
					<h3>
						<img src="static/login/logo.png" alt="Logo" />
					</h3>
				</div>
				<div class="control-group">
					<div class="controls">
						<div class="main_input_box">
							<span class="add-on bg_lg">
							<i><img height="37" src="static/login/user.png" /></i>
							</span><input type="text" name="email" id="email" value="${email }" placeholder="EmailAddress" />
						</div>
					</div>
				</div>
				<div class="control-group">
					<div class="controls">
						<div class="main_input_box">
							<span class="add-on bg_ly">
							<i><img height="37" src="static/login/suo.png" /></i>
							</span><input width="30%" type="text" name="" id="div_vertifyCode" placeholder="验证码" value="" />
						    
						</div>
						
					</div>
				</div>
			<span><input type="button" class="flip-link btn btn-info" id="send_code" onclick="sendCode();" value="发送验证码"></span>
				<div class="form-actions">
					<div style="width:50%;padding-left:8%;width: 50%">
						
						 <span class="pull-right"><a onclick="resetPwd(this);" class="flip-link btn btn-info" id="next_step">下一步</a></span>
					</div>
				</div>

			</form>

			<div class="controls">
				<div class="main_input_box">
					<font color="white"><span id="nameerr">Copyright © FH
							2100</span></font>
				</div>
			</div>
		</div>
	</div>
	<div id="templatemo_banner_slide" class="container_wapper">
		<div class="camera_wrap camera_emboss" id="camera_slide">
			<div data-src="static/login/images/banner_slide_01.jpg"></div>
			<div data-src="static/login/images/banner_slide_02.jpg"></div>
			<div data-src="static/login/images/banner_slide_03.jpg"></div>
		</div>
		<!-- #camera_wrap_3 -->
	</div>

	<script>
		//TOCMAT重启之后 点击左侧列表跳转登录首页 
		if (window != top) {
			top.location.href = location.href;
		}
	</script>

	<script src="static/js/bootstrap.min.js"></script>
	<script src="static/js/jquery-1.7.2.js"></script>
	<script src="static/login/js/jquery.easing.1.3.js"></script>
	<script src="static/login/js/jquery.mobile.customized.min.js"></script>
	<script src="static/login/js/camera.min.js"></script>
	<script src="static/login/js/templatemo_script.js"></script>
	<script type="text/javascript" src="static/js/jquery.tips.js"></script>
	<script type="text/javascript" src="static/js/jquery.cookie.js"></script>
</body>

</html>